<script lang="ts">
  import { t, locale } from "svelte-i18n";
  import { writable } from "svelte/store";
  import { toast } from '@/utils/toastService';
  import {store} from '@/store/index'
  import Card from '@/components/Card.svelte'
  import CenterSwiper from '@/components/CenterSwiper.svelte'
  const count = writable(0);

  function switchToChinese() {
    console.log($t("welcome"), $count);
    // showToast('This is a toast message!');
    toast.show('Hello, this is a toast!')
    $locale = "zh";
  }

  function switchToEnglish() {
    console.log($t("welcome"));
    const apiUrl = import.meta.env.VITE_BASE_URL;
    console.log("API URL:", import.meta.env, apiUrl);
    $locale = "en";
  }
  function getData(){
    let centerStore=store.center
    centerStore.actions.getUserData({onlyMakeTheSame:false})
  }
</script>
<CenterSwiper/>
<h1>{$t("welcome")}</h1>
<p>{$t("about")}</p>
<Card></Card>
<button on:click={switchToChinese}>切换到中文</button>

<button on:click={switchToEnglish}>切换到English</button>

<button on:click={getData}>获取接口数据</button>
